-- This file is part of libmarco
-- http://code.google.com/p/libmarco/
-- This script was found online, here: <???>
-- Compile it as application and drag it into a Finder window toolbar

-- Activates iTerm and makes it switch directory to the frontmost in Finder

tell application "Finder"
	set myWin to window 1
	set thePath to (quoted form of POSIX path of (target of myWin as alias))
end tell
tell application "iTerm"
	activate
	set theSess to current session of current terminal
	write theSess text "cd " & thePath & return
end tell